/// @tags:
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 3e5;

char str[maxn + 5];

int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> (str + 1);
    int n = strlen(str + 1);
    int last = 0;
    for (int i = 1; i <= n; ++i) {
      if (str[i] == '?') {
      } else {
        if (str[i - 1] == '?') {
          char fil = (str[last] == '0' && str[i] == '0') ? '0' : '1';
          if (last == 0) {
            fil = str[i];
          }
          for (int j = last + 1; j < i; ++j) {
            str[j] = fil;
          }
        }
        last = i;
      }
    }
    if (str[n] == '?') {
      char fil = str[last];
      if (last == 0) {
        fil = '0';
      }
      for (int j = last + 1; j <= n; ++j) {
        str[j] = fil;
      }
    }
    cout << (str + 1) << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("C. Best Binary String.in", "r", stdin);
  freopen("C. Best Binary String.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
